<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>会员登录</title>

    <style>
    </style>
</head>
<body>

<%--<div><font>会员登录</font><%=request.getAttribute("msg") == null ? "" : request.getAttribute("msg") %>--%>
<div>会员登录
    <c:if test="${ msg!=null}">
    <font style="color: red;">${not empty msg} - ${msg}</font>
    </c:if>
</div>
<form class="form-horizontal" action="${pageContext.request.contextPath}/login" method="get">

    <div class="form-group">
        <label for="username" class="col-sm-2 control-label">用户名</label>
        <div class="col-sm-6">
<%--            <input type="text" class="form-control" name="username" id="username" placeholder="请输入用户名">--%>
            <input type="text" class="form-control" name="username" id="username" placeholder="请输入用户名" value="${user.username}">
        </div>
    </div>
    <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
        <div class="col-sm-6">
<%--            <input type="password" class="form-control" name="password" id="inputPassword3" placeholder="请输入密码">--%>
            <input type="password" class="form-control" name="password" id="inputPassword3" placeholder="请输入密码"  value="${user.password}">
        </div>
    </div>
    <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">验证码</label>
        <div class="col-sm-3">
            <input type="text" class="form-control" name="yzm" id="inputPassword3" placeholder="请输入验证码">
        </div>
        <div class="col-sm-3">
            <img  id="imgId" src="${pageContext.request.contextPath}/code"  onclick="changeImg()" />
        </div>
        <div class="checkbox">
            <label>
                <input type="checkbox" name="flag" value="ok"> 自动登录
            </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label>
                <input type="checkbox"  name="remember" value="ok"> 记住用户名
            </label>
        </div>
        <input type="submit"  width="100" value="登录。" name="submit" border="0">
    </div>
    </div>

</form>
</body>
<script type="text/javascript">
    function changeImg(){
        // alert("111");
        //获取图片对象
        var imgObj=document.getElementById("imgId");
        //操作src属性 ,new Date()保证每次访问的都是新链接地址，浏览器有缓存机制
        imgObj.src="${pageContext.request.contextPath}/code?date="+new Date();
    }
</script>
</html>